PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Continuation Characters

A simple AppleScript statement must normally be on a single line. If a statement is longer than will fit on one line, you can extend it by including a continuation character , ¬, at the end of one line and continuing the statement on the next. You can enter this character in most text-editing applications by typing Option-L. In the Script Editor, you can also type Option-Return, which inserts the continuation character and moves the insertion point to the next line.

The following statement

open the second file of the first folder of the startup disk

can appear on two lines:

open the second file of the first folder ¬
    of the startup disk

IMPORTANT

This document frequently uses the continuation character for sample statements that don't fit on one line on a document page. It also uses the continuation character in some syntax statements to identify an item that, if included, must appear on the same line as the previous item. The continuation character itself is not a required part of the syntax--it is merely a mechanism for including multiple lines in one statement.

The only place a continuation character does not work is within a string. For example, the following statement causes an error, because AppleScript interprets the two lines as separate statements.

--this statement causes an error:
open the second file of the first folder of disk "Hard ¬
    Disk"

The two dashes (-- ) in the previous example indicate that the first line is a comment. A comment is text that is ignored by AppleScript when a script is run. You add comments to help explain your scripts. For more information, see Comments.

To use a very long string, you can either continue typing without pressing Return, or you can break the string into two or more strings and use the concatenation operator (&) to join them, as in the following example:

open the second file of the first folder of disk "Hard" ¬
    & "Disk"

For more information about the concatenation operator, see Expressions

Note that to compile any of the statements in this section, you must enclose them in a Tell block, such as the following:

tell application "Finder"
    open the second file of the first folder of the startup disk
end tell

© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)